<?php

/**
 * Survey form base class.
 *
 * @package    form
 * @subpackage survey
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 8508 2008-04-17 17:39:15Z fabien $
 */
class BaseSurveyForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'          => new sfWidgetFormInputHidden(),
      'name'        => new sfWidgetFormInput(),
      'description' => new sfWidgetFormInput(),
      'status'      => new sfWidgetFormChoice(array('choices' => array('Under-construction' => 'Under-construction', 'On-going' => 'On-going', 'Closed' => 'Closed'))),
    ));

    $this->setValidators(array(
      'id'          => new sfValidatorDoctrineChoice(array('model' => 'Survey', 'column' => 'id', 'required' => false)),
      'name'        => new sfValidatorString(array('max_length' => 100)),
      'description' => new sfValidatorString(array('max_length' => 200, 'required' => false)),
      'status'      => new sfValidatorChoice(array('choices' => array('Under-construction' => 'Under-construction', 'On-going' => 'On-going', 'Closed' => 'Closed'), 'required' => false)),
    ));

    $this->validatorSchema->setPostValidator(
      new sfValidatorDoctrineUnique(array('model' => 'Survey', 'column' => array('name')))
    );

    $this->widgetSchema->setNameFormat('survey[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'Survey';
  }

}